/*******************************************************************
 * 外语翻译平台(translate) 
 *
 * 成都一亿信息技术公司 版权所有
 * 
 * Copyright (C) 2010 Transer Information Technology Co., Ltd.
 *
 * @Version : 1.0  2010-12-28 下午09:55:12
 *
 * ResourceBundleUtils.java 
 *
 *******************************************************************/
package com.transer.utils;

import java.util.ResourceBundle;

import org.apache.commons.lang.xwork.StringUtils;

/**
 * class defination are there
 * 
 * @author Mark
 * 
 * @version 1.0 ywengineer@gmail.com
 * 
 */
public class ResourceBundleUtils {
	private static final ResourceBundle bundle = ResourceBundle.getBundle("config");

	/**
	 * 
	 */
	private ResourceBundleUtils() {
	}

	public static final Object getObjectValue(String key) {
		return bundle.getObject(key);
	}

	public static final String getStringValue(String key, String[] params) {
		String value = bundle.getString(key);
		// 如果值不为空.
		if (params != null && !StringUtils.isEmpty(value)) {
			if (params.length > 0) {
				for (int index = 0; index < params.length; index++) {
					value = value.replace("{" + index + "}", params[index]);
				}
			}
		}
		return value;
	}
}
